/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package administracion.helper;

import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JPanel;

//~--- non-JDK imports --------------------------------------------------------
import org.icepdf.ri.common.SwingController;
import org.icepdf.ri.common.SwingViewBuilder;

/**
 *
 * @author Luis_Angel
 */
public class Utiles_PDF {

    public static void verArchivo(InputStream is){
         // build a controller
        SwingController controller = new SwingController();
        controller.print(true);
     

        // Build a SwingViewFactory configured with the controller
        SwingViewBuilder factory = new SwingViewBuilder(controller);
        // Use the factory to build a JPanel that is pre-configured
        // with a complete, active Viewer UI.
        JPanel viewerComponentPanel = factory.buildViewerPanel();
    
        // Create a JFrame to display the panel in
        JFrame window = new JFrame("Comprobante");

        window.getContentPane().add(viewerComponentPanel);
        window.pack();
        window.setLocationRelativeTo(null);
        window.setVisible(true);

        // Open a PDF document to view
        controller.openDocument(is, "archivo", "archivo.pdf");
        try {
            is.close();
        } catch (IOException ex) {
            Logger.getLogger(Utiles_PDF.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
